Skip to content

Conversation

@pmorch
Copy link
Contributor

@pmorch pmorch commented Dec 27, 2025

fix(mongodb): Use wait strategy instead of deprecated wait_for_logs

Summary

Replace the deprecated wait_for_logs function with LogMessageWaitStrategy in the MongoDB container module.

This is part of a fix for #874 and similar to:

Changes

  • Import LogMessageWaitStrategy instead of wait_for_logs
  • Pass _wait_strategy=LogMessageWaitStrategy(...) to parent constructor
  • Override _connect() with empty implementation (DbContainer's base implementation uses SQLAlchemy which doesn't apply to MongoDB)

Testing

All existing MongoDB tests pass:

poetry run pytest modules/mongodb/tests/ -v
======================== 4 passed in 16.26s ========================

No deprecation warnings from testcontainers after this change.

Replace the deprecated wait_for_logs function with LogMessageWaitStrategy
in the MongoDB container module.

Part of fix for testcontainers#874
@codecov
Copy link

codecov bot commented Jan 19, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 77.93%. Comparing base (2d9eee3) to head (7d55384).
⚠️ Report is 8 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #943      +/-   ##
==========================================
- Coverage   78.18%   77.93%   -0.25%     
==========================================
  Files          14       14              
  Lines        1210     1210              
  Branches      187      187              
==========================================
- Hits          946      943       -3     
- Misses        222      226       +4     
+ Partials       42       41       -1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants